package com.esl.coordinator.command;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class STiTEQATMELCommandFactory implements ATMELCommandFactory {
	static final Logger LOG = LoggerFactory
			.getLogger(STiTEQATMELCommandFactory.class);

	private static STiTEQATMELCommandFactory stiteqATMELCommandFactory;

	public static STiTEQATMELCommandFactory getInstance() {
		if (stiteqATMELCommandFactory == null) {
			stiteqATMELCommandFactory = new STiTEQATMELCommandFactory();
		}

		return stiteqATMELCommandFactory;
	}

	@Override
	public Command createRFChannelCommand(int channelNumber,
			CommandReceiver commandReceiver) {
		return new ChangeRFChannelCommand(channelNumber, commandReceiver);
	}

	@Override
	public Command createLCDImageDataTransferCommand(String macAddress,
			byte[] imageBytes, CommandReceiver commandReceiver) {
		LOG.debug("ESL MAC in factory: " + macAddress);
		return new LoadImageDataTransferCommand(macAddress, imageBytes,
				commandReceiver);
	}

	@Override
	public Command createLoadLCDInternalPatternSelectCommand(String macAddress,
			int patternArea, int patternNumber, CommandReceiver commandReceiver) {
		return new LoadLCDInternalPatternSelectCommand(macAddress, patternArea,
				patternNumber, commandReceiver);
	}

	@Override
	public Command createSetESLDeviceSleepTimeCommand(String macAddress,
			int rev, int sleepTime, CommandReceiver commandReceiver) {
		return new SetESLDeviceSleepTimeCommand(macAddress, rev, sleepTime,
				commandReceiver);
	}

}
